package com.guang.executor.schduleexecutor;

import com.guang.executor.executorinterupt.ExecutorShutdownNowTest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author lg
 * @Description
 * @date 2022/10/28 14:42
 */
public class ScheduleExecutorTestOne {
    private final static Logger logger = LoggerFactory.getLogger(ScheduleExecutorTestOne.class);
    static ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(1);
    public static void main(String[] args) {
        logger.info("main线程执行代码开始时间");
        scheduledThreadPoolExecutor.schedule(()->{
            logger.info("当前线程执行任务");
        },2, TimeUnit.SECONDS);

        logger.info("main线程继续向下执行");
    }
}
